<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('医院信息化建设个人反馈')" />
    <th:block th:include="include :: datetimepicker-css" />
    <link th:href="@{/css/picker.css}" rel="stylesheet"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-fnryqk-add">

            <div class="form-group">
                <label class="col-sm-3 control-label">问题类型：<span style="color: red;"></span></label>
                <div class="col-sm-8">
<!--                    <select name="wentileixing" class="form-control">-->
<!--                        <option value="">&#45;&#45;请选择&#45;&#45;</option>-->
<!--                        <option value="就诊">就诊</option>-->
<!--                        <option value="饮食">饮食</option>-->
<!--                        <option value="住宿">住宿</option>-->
<!--                        <option value="其他">其他</option>-->
<!--                    </select>-->
                    <span>为更好的向社会人员提供服务，现征求您的宝贵意见，如就诊流程、挂号、预约等</span>
                </div>
            </div>

<!--            <div class="form-group">-->
<!--                <label class="col-sm-3 control-label">人员类型：<span style="color: red;">*</span></label>-->
<!--                <div class="col-sm-8">-->
<!--                    <select name="renyuanleixing" class="form-control">-->
<!--                        <option value="">&#45;&#45;请选择&#45;&#45;</option>-->
<!--                        <option value="病患与家属">病患与家属</option>-->
<!--                        <option value="工作人员">工作人员</option>-->
<!--                        <option value="家属区住户">家属区住户</option>-->

<!--                    </select>-->
<!--                </div>-->
<!--            </div>-->

            <div class="form-group">
                <label class="col-sm-3 control-label">姓名：<span style="color: red;"></span></label>
                <div class="col-sm-8">
                    <input name="xingming" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">联系方式：<span style="color: red;"></span></label>
                <div class="col-sm-8">
                    <input name="lianxifangshi" class="form-control" type="text">
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-3 control-label">反馈留言：<span style="color: red;">*</span></label>
                <div class="col-sm-8">
                    <textarea name="liuyan" rows="3" cols="40"></textarea>

                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-12" style="text-align:center;">
                    <a class="btn btn-primary btn-rounded btn-sm" onclick="add()"><i class="fa fa-plus"></i>&nbsp;提交</a>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />


    <script th:inline="javascript">
        var prefix = ctx + "system/guestbook"


        function add() {

            var guestbook = new Object();

            guestbook.wentileixing = $("select[name='wentileixing']").val();
            guestbook.renyuanleixing = $("select[name='renyuanleixing']").val();
            guestbook.xingming = $("input[name='xingming']").val();
            guestbook.lianxifangshi = $("input[name='lianxifangshi']").val();
            guestbook.liuyan = $("textarea[name='liuyan']").val();

            //
            // if(!guestbook.wentileixing){
            //     alert("请选择问题类型！");
            //     return false;
            // }
            // if(!guestbook.renyuanleixing){
            //     alert("请选择人员类型！");
            //     return false;
            // }
            // if(!guestbook.xingming){
            //     alert("请填写您的姓名！");
            //     return false;
            // }
            // if(!guestbook.lianxifangshi){
            //     alert("请填写您的联系方式 方便我们联系与反馈！");
            //     return false;
            // }
            if(!guestbook.liuyan){
                alert("请填写您要反馈的内容！");
                return false;
            }
            $.ajax({
                type: "post",
                url:  prefix+"/addguestbook",
                data: {
                    "wentileixing":guestbook.wentileixing,
                    "renyuanleixing":guestbook.renyuanleixing,
                    "xingming":guestbook.xingming,
                    "lianxifangshi":guestbook.lianxifangshi,
                    "liuyan":guestbook.liuyan
                },
                success: function(r) {
                    if (r.code == 0) {
                        alert("您的反馈已提交,感谢你对本院信息化建设提供的宝贵意见！");
                        setTimeout("location.href = '/system/guestbook/guestbooklist';", 100 );

                    } else {

                        alert(r.msg);
                    }
                }
            });
        };



    </script>
</body>
</html>